package com.leo.javase.thread.blog;

public class TestStopThread {
	public static void main(String[] args) throws InterruptedException {
		MyThread mt = new MyThread();
		mt.start();
		Thread.sleep(100);
		mt.stopThread();
	}
}
class MyThread extends Thread{
	private boolean isStop = false;
	
	@Override
	public void run() {
		while(!isStop){
			System.out.println(getName());
		}
	}
	
	public void stopThread(){
		isStop = true;
	}
}
